<?php
declare (strict_types = 1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;
use think\response\Json;

//该文件为自动生成，请按需修改
class ShopApply extends Base
{
    //所有定义变量均为演示，请根据实际需求更改

    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\ShopApply';

    //关联模型
    protected $hasOne = ['user','shop'];

    protected array $append = ['examines'];

    public function index(): string
    {
        //构建表格数据
        return Builder::Table()
            ->addColumn(['field' => 'id', 'sort' => true, 'title' => 'ID', 'width' => 80, 'fixed' => 'left'])
            ->addColumn(['field' => 'uid', 'title' => '相关会员', 'templet' => '#_userTpl'])
            ->addColumn(['field' => 'shop_id', 'title' => '店铺类型', 'templet' => '<span>{{d.shop?d.shop.title:"暂无"}}</span>'])
            ->addColumn(['field' => 'name', 'title' => '营业执照名称'])
            ->addColumn(['field' => 'image', 'title' => '营业执照图片', 'width' => 90, 'templet' => '#imagesTpl'])
            ->addColumn(['field' => 'address', 'title' => '地址'])
            ->addColumn(['field' => 'user_name', 'title' => '法人姓名'])
            ->addColumn(['field' => 'phone', 'title' => '联系方式'])
            ->addColumn(['field' => 'examines', 'title' => '状态'])
            ->addColumn(['fixed' => 'right', 'align' => 'center', 'toolbar' => '#barDemo', 'title' => '操作', 'width' => 200])
            ->addRightButtons(['edit' => ['title' => '查看', 'unity_title' => '审核/查看', 'size' => '60%']])
//            ->addSearch([
//                ['title', '等级名称搜索', 'input,Like'],
//            ],false)
            ->fetch();
    }

    public function edit($id = '', $tpl = 'shop_apply/edit', $info = ''): string
    {
        return parent::edit($id, $tpl, $info); // TODO: Change the autogenerated stub
    }


    public function save($param = [], $model = true): Json
    {
        return parent::save($param, $model); // TODO: Change the autogenerated stub
    }

}
